extends CharacterBody2D
@export var speed :=50
@export var player_node: Plyaer
@onready var navigation2d: NavigationAgent2D = $navigation/NavigationAgent2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _physics_process(delta: float) -> void:
	var direction = to_local(navigation2d.get_next_path_position()).normalized()
	velocity = speed * direction
	move_and_slide()
	pass


func _on_timer_timeout() -> void:
	navigation2d.target_position = player_node.position
	pass # Replace with function body.
